<?php	
//cette page code le corps de l'acceuil du site internet
include("verification.php");
$Rubrique = (mysql_fetch_array(mysql_query('SELECT titre,title FROM rubrique WHERE id = 8')));
$RubriqueName = $Rubrique['titre'];

if (!isset($_GET['numpage']))
	$numpage = 1;
else
	$numpage = intval($_GET['numpage']);
//ici on calcule le nombre de photo sur la page:
$nb = 1;
$sql = 'SELECT * FROM galerie ';
if (intval($_GET['chainehotel']) != '')
	$sql .= 'WHERE idChaineHotel = '. intval($_GET['chainehotel']);
if (intval($_GET['hotel']) != '')
	$sql .= 'WHERE idHotel = '. intval($_GET['hotel']);
	
$PatrimoineListe = mysql_query($sql);

$total = mysql_num_rows($PatrimoineListe);
while ( $Patrimoine = mysql_fetch_array($PatrimoineListe)) 
{
if ( ($numpage-1)*16 < $img && $nb < 16)
	$nb ++;
$img ++;
}
if ($nb % 4 != 0) $add = 1; else $add = 0;
$ligne =(int)($nb / 4) + $add;
if (preg_match("#MSIE#", $_SERVER["HTTP_USER_AGENT"]))
	$IE = 1;
else $IE = 0;


if (isset($_GET['chainehotel']))
	$_SESSION['idChaineHotel'] = intval($_GET['chainehotel']);
else
	$_SESSION['idChaineHotel'] = 0;
if (isset($_GET['hotel']))
	$_SESSION['idHotel'] = intval($_GET['hotel']);
else
	$_SESSION['idHotel'] = 0;
?>	

<br/>
<br/>
<div style="margin-left:10px;float:left;height: 550px;" width="220">
	<?php $ListeChaineHotel = mysql_query('SELECT * FROM chainehotel ORDER BY idChaineHotel');
	while ($ChaineHotel = mysql_fetch_array($ListeChaineHotel)){
	?>
	<div <? if (!$IE){?> style="height:45px;" <?}?>>
	<table style="border-collapse : collapse ;">
		<tr>
			<td>
					<?  if (is_file("images/Logo_Chaine_Hotel/".$ChaineHotel['Logo']))
							$imageSize = getimagesize("./images/Logo_Chaine_Hotel/".$ChaineHotel['Logo']);
							?>
					<div width="35" height="35" style="margin-left:<? if ($imageSize[0]<35) echo (35-$imageSize[0])/2?>px;margin-right:<? if ($imageSize[0]<35) echo (35-$imageSize[0])/2?>px;margin-top:<? if ($imageSize[1]<35) echo (35-$imageSize[1])/2?>px;margin-bottom:<? if ($imageSize[1]<35) echo (35-$imageSize[1])/2?>px;">
					<a onClick="update_galerie(1, <? echo $ChaineHotel['idChaineHotel'];?>, 0);" style="cursor:pointer;">
					<img src="images/Logo_Chaine_Hotel/<?php echo $ChaineHotel['Logo']?>"  style="max-height:35px; max-width:35px; width: expression(this.width > 35 ? '35px' : true);height: expression(this.height > 35 ? '35px' : true);"></a>
				</div>
			</td>
			<td width="165">
			<div width="165" style="<?php if ($_GET['chainehotel'] == $ChaineHotel['idChaineHotel']) { ?>background-color:rgb(230,230,230);<?php } ?>padding:3px;padding-top:10px;height:35px;margin-left:10px;width:130px;">
			
			<span style="font-family:Arial;margin-left:10px;"><a onClick="update_galerie(1, <? echo $ChaineHotel['idChaineHotel'];?>, 0);" style="cursor:pointer;"><?php echo stripslashes($ChaineHotel['Nom'.$langue])?></a></span></div></td>
			<? if ($IE){?><span style="font-size:7px;"><br/></span><?}?>
		</tr>
	</table>
	</div>
	<?php } ?>

</div>
<?php
$img = 1;
if (preg_match("#MSIE#", $_SERVER["HTTP_USER_AGENT"])) {
?>
<div style="position:absolute;left:500px; width:440px" id="galerie">
<?php } else { ?>
<div style="position:relative;float:left; width:440px" id="galerie">
<?php } ?>


<SCRIPT language="Javascript"> 


function update_galerie(Page, idChaineHotel, idHotel)
{
	new Ajax.Updater('galerie', 'ajax/update_galerie.php', 
	{ 
		method: 'post', 
		onLoading: function(xhr) { $('galerie').hide();  } , 
		onComplete : function(transport) {  Effect.Appear('galerie'); },
		parameters: { Page: Page, idChaineHotel: idChaineHotel, idHotel: idHotel}
	});
}

update_galerie(1,0, <? echo $_SESSION['idHotel'];?>);
</script>




